package com.example.forestmanagement;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageButton;
import android.widget.SearchView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

public class HistoryDataActivity extends AppCompatActivity {
    private SearchView searchView;
    private RecyclerView recyclerView;
    private ImageButton btnBack;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_history_data);

        searchView = findViewById(R.id.search_view);
        recyclerView = findViewById(R.id.recycler_view);
        btnBack = findViewById(R.id.btn_back);

        setupViews();
    }

    private void setupViews() {
        btnBack.setOnClickListener(v -> finish());

        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        // TODO: 设置适配器并加载数据

        searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
            @Override
            public boolean onQueryTextSubmit(String query) {
                // TODO: 执行搜索请求
                return true;
            }

            @Override
            public boolean onQueryTextChange(String newText) {
                return false;
            }
        });
    }

    private void onForestItemClick(String forestId) {
        Intent intent = new Intent(this, ForestDetailActivity.class);
        intent.putExtra("forest_id", forestId);
        startActivity(intent);
    }
} 